<?php

namespace common\models\db\tables;

use Yii;

/**
 * This is the model class for table "{{%skus}}".
 *
 * @property int $id
 * @property int|null $copied_by_id
 * @property int $spu_id
 * @property int $sort 排序
 * @property int $created_at
 * @property int $updated_at
 * @property int|null $cover_file_id 封面
 * @property int $inventory 库存数量
 * @property float $cost_price 成本价
 * @property float $shop_price 店主价
 * @property float $sale_price 售价
 * @property float $guide_price 指导价
 * @property float $commission_price 上级分佣
 * @property float $reward_price 分享奖励
 * @property int $sales_volume 销量
 */
class Skus extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%skus}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['copied_by_id', 'spu_id', 'sort', 'created_at', 'updated_at', 'cover_file_id', 'inventory', 'cost_price', 'shop_price', 'sale_price', 'guide_price', 'commission_price', 'reward_price', 'sales_volume'], 'trim'],
            [['copied_by_id', 'spu_id', 'sort', 'created_at', 'updated_at', 'cover_file_id', 'inventory', 'sales_volume'], 'integer'],
            [['spu_id', 'created_at', 'updated_at'], 'required'],
            [['cost_price', 'shop_price', 'sale_price', 'guide_price', 'commission_price', 'reward_price'], 'number'],
            [['copied_by_id', 'cover_file_id'], 'default', 'value' => null],
            [['sort', 'inventory', 'sales_volume'], 'default', 'value' => 0],
            [['cost_price', 'shop_price', 'sale_price', 'guide_price', 'commission_price', 'reward_price'], 'default', 'value' => 0.00],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'copied_by_id' => Yii::t('app', 'Copied By ID'),
            'spu_id' => Yii::t('app', 'Spu ID'),
            'sort' => Yii::t('app', '排序'),
            'created_at' => Yii::t('app', 'Created At'),
            'updated_at' => Yii::t('app', 'Updated At'),
            'cover_file_id' => Yii::t('app', '封面'),
            'inventory' => Yii::t('app', '库存数量'),
            'cost_price' => Yii::t('app', '成本价'),
            'shop_price' => Yii::t('app', '店主价'),
            'sale_price' => Yii::t('app', '售价'),
            'guide_price' => Yii::t('app', '指导价'),
            'commission_price' => Yii::t('app', '上级分佣'),
            'reward_price' => Yii::t('app', '分享奖励'),
            'sales_volume' => Yii::t('app', '销量'),
        ];
    }
}
